package sources;





/**
 * @author Kyniek
 * 
 * Generuje klucze auto inkrementujące się
 */
public class SequenceGenerator extends EmptySource implements ISource //,IGen
{
	private long id;
	
	

	public SequenceGenerator(String nam)
	{
		super(nam, "INTEGER");
		id = 0;
		System.out.println("PKGenerator : PKGenerator()");
	}	
	
	
	public SequenceGenerator(String nam, String type)
	{
		super(nam, type);
		id = 0;
		System.out.println("PKGenerator : PKGenerator()");
	}	


	@Override
	public Integer get()
	{		
		Integer res =  (int)id;
		id++;
		return res;
	}

	@Override
	public Integer[] get(int dataSize)
	{
		Integer[] res = new Integer[dataSize];

		for(int i = 0; i < res.length; i++)
		{
			res[i] = get();
		}
		
		return res;
	}
}
